import userStore from "@/store/userState";

const userInfoReducer = (state = { ...userStore.state }, action: {type: string, value: number}) => {
    const newState = JSON.parse(JSON.stringify(state))
    for (const key in userStore.actionNames) {
        if(action.type === userStore.actionNames[key]) {
            userStore.actions[userStore.actionNames[key]](newState, action)
            break
        }
    }
    return newState
}

export default userInfoReducer